<template>
  <h1>App组件标题</h1>
  <p>App组件数据:{{ num }}</p>
  <p>这孙子组件传来的参数:{{ price }}</p>
  <button @click="num++">修改数据</button>
  <hr />
  <HelloWorld :msg="msg" :num="num"></HelloWorld>
</template>

<script>
import HelloWorld from "./components/HelloWorld";
import { provide, ref } from "vue";
export default {
  name: "App",
  components: { HelloWorld },
  setup() {
    let msg = ref("hashMap");
    let num = ref(26);

    let price = ref(0);

    provide("cash", num);
    provide("currency", getPrice);

    function getPrice(val) {
      price.value = val;
    }
    return {
      msg,
      num,
      price,
    };
  },
  computed: { HelloWorld },
};
</script>

<style>
</style>